<?php require_once LAYOUTPATH.'layout_header.php'; ?>

<h1><?php echo $page_title; ?></h1>

<div id="bricabox_tabs" class="admin">
	<ul>
		<li class="back"><a href="/">&lsaquo; Back to your BricaBox</a></li>
		<?php render_tabs($admin_tabs); ?>
	</ul>
	<ul id="sub_tabs">
		<li class="current"><a href="/admin/general/basic">Basic</a></li>
		<li><a href="/admin/general/terms">Interaction</a></li>
		<li><a href="/admin/general/appearance">Appearance</a></li>
		<li><a href="/admin/general/domain">Domain name</a></li>
	</ul>
</div>

<?php require_once FLASHPARTIAL; ?>

<form action="/bricabox/<?php echo $bricabox->id; ?>/save" method="post">
	<input type="hidden" name="section" value="general" />
	<input type="hidden" name="view" value="basic" />
	<fieldset class="with_sections">
		<div>
			<label for="bricabox_name"><span class="req">*</span>Name your BricaBox:</label><br />
			<input type="text" id="bricabox_name" name="bricabox[name]" value="<?php echo $bricabox->name; ?>" />
		</div>
		
		<div>
			<label for="bricabox_description"><span class="req">*</span>Tell us a little about your BricaBox:</label><br />
			<textarea id="bricabox_description" name="bricabox[description]" rows="5" cols="45"><?php echo $bricabox->description; ?></textarea>
		</div>
		
		<?php if ($this->bricabox->bricabox_has_block($bricabox->id, 'wiki')): ?>
		<div>
			<label for="bricabox_default_wiki_text">Set some default text for the Wiki block:</label><br />
			<textarea id="bricabox_default_wiki_text" name="bricabox[default_wiki_text]" rows="5" cols="45"><?php echo htmlentities($bricabox->default_wiki_text); ?></textarea>
		</div>
		
		<!-- Tiny MCE -->
		<script type="text/javascript" charset="utf-8">
			tinyMCE.init({
				mode: 		"exact",
				elements: 	"bricabox_default_wiki_text",
				theme: 		"advanced",
				plugins: 	"safari",
				theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,bullist,numlist,|,link,unlink,image,cleanup,|,help",
				theme_advanced_buttons2: "",
				theme_advanced_buttons3: "",
				theme_advanced_buttons4: "",
				theme_advanced_toolbar_location: "top"
			});
		</script>
		<?php else: ?>
		<input type="hidden" name="bricabox[default_wiki_text]" value="<?php echo htmlentities($bricabox->default_wiki_text); ?>" />
		<?php endif; ?>
		
		<div>
			<label for="bricabox_privacy">Who can see your BricaBox?</label><br />
			<select name="bricabox[privacy]" id="bricabox_privacy">
				<option value="0"<?php if ($bricabox->privacy == 0) echo ' selected="selected"'; ?>>Only members</option>
				<option value="1"<?php if ($bricabox->privacy > 0)  echo ' selected="selected"'; ?>>Everyone</option>
			</select>
		</div>
		
		<div>
			<input type="hidden" name="bricabox[members_must_apply]" value="0" />
			<input type="checkbox" id="must_apply" name="bricabox[members_must_apply]" value="1"<?php if ($bricabox->members_must_apply) echo ' checked="checked"'; ?> />
			<label for="must_apply">Users must apply to become members (This only applies if you've chosen &quot;Everyone&quot; above. <a href="#">Huh?</a>)</label>
		</div>
		
		<!--
		<div>
			<input type="hidden" name="bricabox[can_clone]" value="0" />
			<input type="checkbox" id="can_clone" name="bricabox[can_clone]" value="1"<?php if ($bricabox->can_clone) echo ' checked="checked"'; ?> />
			<label for="can_clone">Allow other users to create new BricaBoxes based on this one</label>
		</div>
		-->
		
		<div>
			<input type="hidden" name="bricabox[clone_no_copy_theme]" value="0" />
			<input type="checkbox" id="clone_no_copy_theme" name="bricabox[clone_no_copy_theme]" value="1"<?php if ($bricabox->clone_no_copy_theme) echo ' checked="checked"'; ?> />
			<label for="clone_no_copy_theme">Don't allow people to copy this BricaBox's theme</label>
		</div>
		
		<div class="controls">
			<input type="submit" value="Save changes" />
			or <a href="/admin">cancel</a>
		</div>
		
		<h2>Delete your BricaBox</h2>
		<p style="margin-top: 8px;"><a style="color: #b00; border: none; font-weight: bold;" href="/bricabox/<?php echo $bricabox->id; ?>/delete" onclick="return confirm('Are you absolutely sure? There is no undo.');">I want to delete my BricaBox</a></p>
	</fieldset>
</form>

<?php require_once LAYOUTPATH.'layout_footer.php'; ?>